//
//  MyConfig.m
//  BaseProject
//
//  Created by zhangrongbing on 16/9/26.
//  Copyright © 2016年 lovcreate. All rights reserved.
//

#import "MyConfig.h"

@implementation MyConfig

+(MyConfig*)sharedMyConfig{
    static dispatch_once_t dispatch = 0;
    static MyConfig* object = nil;
    dispatch_once(&dispatch, ^{
        object = [[self class] new];
    });
    [[UINavigationBar appearance]setTranslucent:NO];
    return object;
}

-(id)init{
    if (self = [super init]) {
        _isShowLog = YES;//默认输入日志
        self.defaults = [NSUserDefaults standardUserDefaults];
        // 当前设备系统版本
        self.osVersion = [[UIDevice currentDevice].systemVersion floatValue];
    }
    return self;
}

-(void)setToken:(NSString *)token{
    if(token!=nil){
        [[NSUserDefaults standardUserDefaults]setObject:token forKey:TOKEN];
    }else{
        NSLog(@"token is nil");
    }
}

//获取token
-(NSString *)token{
    return [[NSUserDefaults standardUserDefaults]objectForKey:TOKEN];
}

//存储userId
- (void)setUserId:(NSString *)userId
{
    if (userId != nil) {
        [[NSUserDefaults standardUserDefaults]setObject:userId forKey:UESRID];
    }else{
        NSLog(@"userId is nil");
    }
}

//获取userId
- (NSString *)userId
{
    return [[NSUserDefaults standardUserDefaults]objectForKey:UESRID];
}

//存储userId
- (void)setUserName:(NSString *)userName
{
    if (userName != nil) {
        [[NSUserDefaults standardUserDefaults]setObject:userName forKey:USERNAME];
    }else{
        NSLog(@"userName is nil");
    }
}

//获取userId
- (NSString *)userName
{
    return [[NSUserDefaults standardUserDefaults]objectForKey:USERNAME];
}

//存储推送标识
-(void)setIsNotify:(NSString *)isNotify{
    if(isNotify!=nil){
        [[NSUserDefaults standardUserDefaults]setObject:isNotify forKey:ISNOTIFY];
    }else{
        NSLog(@"isNotify is nil");
    }
}

//获取存储推送标识
-(NSString *)isNotify{
    return [[NSUserDefaults standardUserDefaults]objectForKey:ISNOTIFY];
}



@end
